<template>
    <rx-dialog :showcancel="false" :showok="false">
        <rx-layout>
            <div slot="center">
                <a-form-model ref="form" :model="mdl">
                    <a-row>
                        <a-col :span="24">
                            <a-form-model-item :label="i18n('form.taskName','任务名称')" prop="taskName" :label-col="labelCol1" :wrapper-col="wrapperCol1">
                                {{mdl.taskName}}
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                    <a-row>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.nodeName','节点名称')" prop="nodeName" :label-col="labelCol" :wrapper-col="wrapperCol">
                                {{$i18(mdl.nodeName,"节点名称")}}
                            </a-form-model-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.createByName','任务所属人')"  prop="createByName" :label-col="labelCol" :wrapper-col="wrapperCol">
                                {{mdl.createByName}}
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                    <a-row>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.startTime','开始时间')" prop="startTime" :label-col="labelCol" :wrapper-col="wrapperCol">
                                {{mdl.startTime}}
                            </a-form-model-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.endTime','结束时间')"  prop="endTime" :label-col="labelCol" :wrapper-col="wrapperCol">
                                {{mdl.endTime}}
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                    <a-row>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.duration','执行时长')"  prop="duration" :label-col="labelCol" :wrapper-col="wrapperCol">
                                {{(mdl.duration/1000).toFixed(2)+"s"}}
                            </a-form-model-item>
                        </a-col>
                        <a-col :span="12">
                            <a-form-model-item :label="i18n('form.isSuccess','执行结果')"  prop="isSuccess" :label-col="labelCol" :wrapper-col="wrapperCol">
                                <a-tag v-if="mdl.isSuccess" :color="statusMap[mdl.isSuccess].color">
                                    <span>{{ statusMap[mdl.isSuccess].text }}</span>
                                </a-tag>
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                    <a-row>
                        <a-col :span="24">
                            <a-form-model-item  :label="i18n('form.message','详细信息')" prop="message" :label-col="labelCol1" :wrapper-col="wrapperCol1">
                                <a-textarea
                                    v-model="mdl.message"
                                    :auto-size="{ minRows: 2,maxRows: 15}"
                                />
                            </a-form-model-item>
                        </a-col>
                    </a-row>

                </a-form-model>
            </div>
        </rx-layout>
    </rx-dialog>
</template>
<script>
import BpmAsyncTaskApi from '@/api/bpm/core/bpmAsyncTask'
import {RxDialog, BaseFormModel} from '@lowcode/jpaas-common-lib';


export default {
    name: 'BpmAsyncTaskEdit',
    mixins: [BaseFormModel],
    components: {
        RxDialog,
    },
    data() {
        return {
            statusMap: {
                "SUCCESS": {color: 'green', text: this.i18n("list.success","成功")},
                "ERROR": {color: 'red', text: this.i18n("list.error","失败")},
                "RUNNING": {color: 'blue', text: this.i18n("list.running","运行中")},
            },
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"BpmAsyncTask",key);
        },
        get(id) {
            return BpmAsyncTaskApi.get(id);
        },
    }
}
</script>
<style>
.relick a {
    margin-right: 10px;
}

</style>
